package com.wnnight.wys.entity.repairs;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wnnight.wys.groupInterface.AddGroup;
import com.wnnight.wys.groupInterface.AlterGroup;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author rzh6230
 * 2022/8/27 16:53
 */
@Getter
@Setter
@ToString
@TableName(value = "repairs_place", keepGlobalPrefix = true)
@ExcelIgnoreUnannotated
public class RepairsPlace {
    @TableId(type = IdType.AUTO)
    @NotNull(message = "地址id不能为空", groups = AlterGroup.class)
    @ExcelProperty(value = "id",index = 0)
    private Integer id;
    @NotBlank(message = "地址名称不能为空", groups = {AddGroup.class, AlterGroup.class})
    @Size(min = 1, max = 20, message = "地址最大为20个字符", groups = {AddGroup.class, AlterGroup.class})
    @ExcelProperty(value = "地址名称",index = 1)
    private String name;
    @Min(value = 0, message = "父ID不能小于0", groups = {AddGroup.class, AlterGroup.class})
    @ExcelProperty(value = "父ID",index = 2)
    private Integer parentId;
    @TableField(exist = false)
    private List<RepairsPlace> sonPlace;
}
